
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';

import reducers from './reducer'      //引入所有的reducers

import { createLogger } from 'redux-logger';
import promise from 'redux-promise';

import createSagaMiddleware from 'redux-saga';       // 引入redux-saga中的createSagaMiddleware函数
import sages from '../sages';

const sagaMiddleware = createSagaMiddleware()        // 执行
const logger = createLogger();
//组合新的Store （支持异步，日志）

// 开启浏览器redux调试工具

const reduxDevtools =global.window && window.devToolsExtension ? window.devToolsExtension() : f => f

const store = createStore(
    reducers,
    compose(applyMiddleware(promise, logger,sagaMiddleware), reduxDevtools),
   
)
sagaMiddleware.run(sages)                                
export default store